﻿#ifndef SERVER_H
#define SERVER_H

#include <QObject>
#include <httppostrequest.h>

class Server : public QObject
{
    Q_OBJECT
public:
    explicit Server(QObject *parent = 0);

signals:
    void get_server_info_signal();
    void get_all_unpaid_order_signal();
    void check_out_signal();

public slots:
    void get_server_by_order_id_finished();
    void server_modify_info_finished();
    void get_server_review_rank_finished();
    void get_server_info_finished();
    void get_all_unpaid_order_finished();
    void check_out_finished();

public:
    HttpPostRequest *request = new HttpPostRequest();
    HttpPostRequest *order_request = new HttpPostRequest();
    void get_server_by_order_id(QJsonObject &data);
    void server_modify_info(QJsonObject &data);
    void get_server_review_rank(QJsonObject &data);
    void get_server_info(QString token, int uid);
    void get_all_unpaid_order();
    void check_out(int order_id, double total_money);
    int uid;
    int id;
    QString jwt_token;
    QString name;
    QString phone;
    int prefer;
    QString sex;
    QJsonArray food_list;
    QJsonArray order_list;
    QJsonArray unpaid_order_list;
};

#endif // SERVER_H
